<?php

/**
 * Created by ymk
 * User: Administrator
 * Date: 2018/6/21
 * Time: 10:10
 */

namespace MeetUp\Model;

use Illuminate\Database\Eloquent\Model;

class UserActivity extends Base
{
    protected $table = 'user_activity';
    protected $dates = ['deleted_at'];
    protected $fillable = ['m_uid','m_activityid','is_start'];
    //关联用户users
    public function user(){
        return $this->hasOne('MeetUp\Model\Users','id','m_uid');
    }
    //关联活动
    public function activity(){
        return $this->hasOne('MeetUp\Model\Activity','activity_id');
    }

    //参与聚会的人数
    public function user_count($id){
        return $this->where(['m_activityid'=>$id])->count();
    }
}